import Vue from 'vue';
import VCharts from 'v-charts';
import ElementUI from 'element-ui';
import App from './App.vue';
import router from './router';
import api from './apis';
import store from './store';


import 'element-ui/lib/theme-chalk/index.css';

Vue.use(ElementUI);
Vue.use(VCharts);
Vue.use(api);

router.beforeEach((to, from, next) => {
  if (to.meta.needLogin) {
    if (!localStorage.token) {
      next({ name: 'login' });
    }
  }
  next();
});


// Vue.config.productionTip = true;

new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount('#app');
